package com.zhika.zishi.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.TableRow;

import com.zhika.zishi.R;
import com.zhika.zishi.customview.TitleView;
import com.zhika.zishi.interfaces.TitleInterface;

/**
 * Created by shi-02 on 2015/4/20.
 * 添加问题的Activity
 */
public class QuizActivity extends BaseActivity implements View.OnClickListener{

    private TitleView titleView;

    private EditText problemTitleEdit;

    private TableRow quizRow;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.quiz_layout);

        initView();
    }

    private void initView(){
        titleView = (TitleView) findViewById(R.id.quiz_title_view);
        titleView.setLeftButtonText("取消");
        titleView.setMiddleRowText("提问");
        titleView.setRightButtonText("发布");
        titleView.setTitleViewInterface(new TitleInterface() {
            @Override
            public void leftTitleListener() {
                finish();
            }

            @Override
            public void middleTitleListener() {

            }

            @Override
            public void rightTitleListener() {

            }
        });

        problemTitleEdit = (EditText) findViewById(R.id.quiz_problem_title_edit);
        Intent intent = getIntent();
        String problemTitle = intent.getStringExtra("problemtitle");
        if (problemTitle!=null){
            problemTitleEdit.setText(problemTitle);
        }

        quizRow = (TableRow) findViewById(R.id.quiz_invite_row);
        quizRow.setOnClickListener(this);


    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.quiz_invite_row:
                quizRowListener();
                break;
        }
    }

    private void quizRowListener(){
        Intent intent = new Intent(QuizActivity.this,InviteAnswerActivity.class);
        startActivity(intent);
    }
}
